<template>
  <!--枚举管理-->
    <basic-container>
        <div>
            <m-s-search :list="EnumManageOption.column" @searchClick="v=>{queryForm=v,page.currentPage=1,getList()}"></m-s-search>
        </div>
        <avue-crud :option="EnumManageOption"
                   :table-loading="loading"
                   :data="data"
                   @selection-change="v=>selection=v"
                   @current-change="currentChange"
                   @size-change="sizeChange"
                   ref="crud"
                   :page.sync="page">
            <template slot="menuLeft" slot-scope="{size}">
                <el-button :size="size" type="primary"
                           @click="addToTabsList('枚举',{oid:-1},'enumManageTemp','open')">创建
                </el-button>
                <el-button :size="size" type="danger" @click="remove(selection)" :disabled="selection.length===0">删除
                </el-button>
                <el-button :size="size" @click="start_stop(selection,'start')"
                           :disabled="selection.length===0">启用
                </el-button>
                <el-button :size="size" @click="start_stop(selection,'stop')"
                           :disabled="selection.length===0">停用
                </el-button>
            </template>

            <template slot="nameCn" slot-scope="{row}">
                <div class="column-btn" @click="addToTabsList(row.nameCn+'枚举',row,'enumManageTemp','view')">
                    {{ row.nameCn }}
                </div>
            </template>

            <template slot="menu" slot-scope="{row}">
                <el-button type="text" @click="addToTabsList(row.nameCn+'枚举',row,'enumManageTemp','view')">查看详情
                </el-button>
                <el-button type="text" @click="addToTabsList(row.nameCn+'枚举',row,'enumManageTemp','edit')">修改
                </el-button>
                <el-button type="text" @click="start_stop([row],'stop')" :disabled="row.state===0">停用</el-button>
            </template>
        </avue-crud>

        <ms-drawer @refresh="getList()" :visible.sync="visible" :tab-list.sync="tabsList"></ms-drawer>

    </basic-container>
</template>
<script>
import MSSearch from "@/DMDComponents/MSSearch.vue";
import commonJs from "../../util/commonJs"

export default {
    name: "EnumManage",
    components: {MSSearch},
    inject: ["EnumManageOption"],
    mixins: [commonJs],
}
</script>
